package com.stylefeng.guns.modular.wz.warpper;

import com.stylefeng.guns.common.constant.Consts;
import com.stylefeng.guns.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.core.base.warpper.BaseControllerWarpper;

import java.util.List;
import java.util.Map;

/**
 * @program: guns
 * @description: 问卷包装类
 * @author: Chenchao
 * @create: 2018-03-22 13:08
 **/
public class WzQuestionnaireWarpper extends BaseControllerWarpper {
    public WzQuestionnaireWarpper(List<Map<String, Object>> list) {
        super(list);
    }

    @Override
    protected void warpTheMap(Map<String, Object> map) {
        if(map.get("type") != null){
            map.put("type", ConstantFactory.me().getDictsByName("问卷类型",Integer.parseInt(map.get("type").toString())));
        }
        if(map.get("publishingType") != null){
            map.put("publishingType", ConstantFactory.me().getDictsByName("问卷发布类型",Integer.parseInt(map.get("publishingType").toString())));
        }
        if(map.get("status") != null){
            map.put("status", ConstantFactory.me().getDictsByName("问卷状态",Integer.parseInt(map.get("status").toString())));
        }
        map.put("coverUrl", Consts.DOMAIN+map.get("coverUrl"));
    }
}
